package com.ruyuan.seckilling.activity.request;

import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.Objects;

/**
 * @author zhonghuashishan
 */
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class ActivitySkuRefModifyRequest {

    private Long activitySkuRefId;

    private Integer price;

    private Integer seckillingStock;

    public String validateParams() {
        if (Objects.isNull(activitySkuRefId) || activitySkuRefId <= 0) {
            return "参数不合法";
        }
        if (Objects.nonNull(price) && price < 0) {
            return "商品原价不合法";
        }
        if (Objects.nonNull(seckillingStock) && seckillingStock <= 0) {
            return "商品秒杀数量不合法";
        }
        return null;
    }
}
